﻿using Nokia.Graphics.Imaging;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Windows.Storage.Streams;

namespace NiklasKarl.WarpCam.Effects
{
    public enum CameraHandlerPropertyType
    {
        Slider,
        Switch
    }

    public abstract class CameraHandlerProperty
    {
        private string _name;
        private Guid _guid;

        public abstract CameraHandlerPropertyType PropertyType { get; }

        public string PropertyName { get { return _name; } }

        public Guid PropertyGuid { get { return _guid; } }

        protected CameraHandlerProperty(string name, Guid guid)
        {
            _name = name;
            _guid = guid;
        }
    }

    public class CameraHandlerSliderProperty : CameraHandlerProperty
    {
        private int _minValue;
        private int _maxValue;

        public override CameraHandlerPropertyType PropertyType { get { return CameraHandlerPropertyType.Slider; } }

        public double MaxValue { get { return _maxValue; } }

        public double MinValue { get { return _minValue; } }

        public CameraHandlerSliderProperty(string name, Guid guid, int minValue, int maxValue) :
            base(name, guid)
        {
            _minValue = minValue;
            _maxValue = maxValue;
        }
    }

    public interface ICameraEffect
    {
        IReadOnlyList<CameraHandlerProperty> Properties { get; }

        void SetProperty(Guid guid, object value);

        object GetProperty(Guid guid);

        Task<Bitmap> GetBitmapImage(IImageProvider source, Bitmap destination, Rotation rotation);

        Task<IBuffer> GetJpegImage(IImageProvider source, Rotation rotation);
    }
}
